home *** CD-ROM | disk | FTP | other *** search
- Path: seismo!uunet!rs
- From: rs@uunet.UU.NET (Rich Salz)
- Newsgroups: comp.sources.unix
- Subject: v10i004: Crypt Breaker's Workbench, Part04/11
- Message-ID: <376@uunet.UU.NET>
- Date: 17 Jun 87 22:41:49 GMT
- Organization: UUNET Communications Services, Arlington, VA
- Lines: 1715
- Approved: rs@uunet.uu.net
-
- Submitted by: Robert W. Baldwin <BALDWIN@XX.LCS.MIT.EDU>
- Mod.sources: Volume 10, Issue 4
- Archive-name: cbw/Part04
-
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 4 (of 11)."
- # Contents: UU.test UU.test1 autotri.c dline.c specs.h test.txt user.c
- # Wrapped by rs@uunet on Wed Jun 17 18:17:13 1987
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f UU.test -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"UU.test\"
- else
- echo shar: Extracting \"UU.test\" \(8718 characters\)
- sed "s/^X//" >UU.test <<'END_OF_UU.test'
- Xbegin 644 test.cipher
- XMK^D=OM^/7]Q/RL"9_4AY*RCP`/[KZHU"6Z5:W(U05KF^@U%0-+PS8[6OL_^F
- XM.4\,B+%AZ"3`@N&T\3#<LMVP!/'#]*C7-6"V5?!3-^4.!I$`^OXT!\L53\O9
- XMPL&FC'**K^/D\$#7[28E!:7SHS0&E'GW!$CJ7/A:.?$JE-`5%1,76RXB[6-?
- XM`9.9[^J6F)25KZZQ3.-*\LERQ^0TQ=^;YW-%_D/AJT!@9M;;"`(&(?D/?^[D
- XMJ#^_5(*(7/RT%%"8L'VJ2"[Y=-S;#I]O=I)_?F7QKG_>8)O;LOYUKT97YZW2
- XMZ.>VI0LD"5B&G^[[G.;@/9CQIJ"4!:D,FZVLW_DU/K.4D/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>ZZJ<V979`W!>[^3L[R[:KF-
- XMP[;*R>7G6M38"C"KS`TG?=V56=K1H:FL(XK_FPXO_*NJ&JAG">S'TSM+19O=
- XMW#"#BR/,#`N/_*?!DO=/O0Y_%12!+0BZ19-*1[^9F"BF$"IG;X(XCQ_[!,7$
- XM97F<,BM5J!LU"86<2)JEM7\.E1RA%0(N+8A+MCS$\D::)'_%$*RK[GV6F#^3
- XME3R0%`_G^;&P!(CA=NO9"`VG"]G4,V@R2<]$.U]3*[S4N+>VD3:&QC30LJX(
- XMZ!!85W(6Q'?^47>+WQ>(8+HLAF.P);1V<>UY>"X`37J:)E=#^6Y>(L2`ET,S
- X%A:$T1XP6
- X`
- Xend
- END_OF_UU.test
- if test 8718 -ne `wc -c <UU.test`; then
- echo shar: \"UU.test\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f UU.test1 -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"UU.test1\"
- else
- echo shar: Extracting \"UU.test1\" \(8715 characters\)
- sed "s/^X//" >UU.test1 <<'END_OF_UU.test1'
- Xbegin 644 test1.cipher
- XMUOK1$>_\&3%/P4O]]LZ;JN[MM6#C+3$&?J4MLCT;V=B=?5&/]*CR5I1/N(ON
- XM1_Q5C1[H,X1(`*;%6L.1I]Q=ZD3#Y=AB.6!YF]-ZU=?VU0;,OW[400:*B3@T
- XMES+W1/+3V!70X^+7[8WKW]T#(9:A?H1^RGR8P<+<0Q:P%"!4Z\VE42_N`,S<
- XM`<DGQUHV-3[JK^C?C^B-M8_(W.1LUNEGYRB"Y(D'N")`9CY\]>S85^T6.-9)
- XM5.U3".(V\3C>HJ4]FH%&!`.[3T&D<4Q+:P]_3R5F4R+>JVC;>6<*%1E85]!E
- XMZ)KF;A-?.D-<KSM'6";`"U3G$B4&GIVO1,GO,A```9*RC!)0<%BU)=#=QHI-
- XM.-S>@:7OH#Z`B[P!G6H?&CPYU9<V3P4S%)7-!__GIU*4>G>)+@(=+&Y[BN9)
- XM$(;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@1HT;;1N@74E;JYU+ZJ
- XM7=U`/R/@UY]:">R;KXI/3I>\J<LYO@A/3:JI-XN7(3</2RV@+CDC.SKP0L5\
- XMIZ\V!"F;*?"O[EGY(P7IF'_/DT1#*-83_\N[T6`Z'YL_"0A.>JP=!:D:`J;M
- XME>>086!\GN$C!'[A`E<`V31'G4L]+UHQ+V)$)>VAH)\4V+O510#?EP>SB["O
- XMRBHXP;6IBG?U,'2++KP#NTKD*&/0I,/"822/4S_&U((=N/2J94&,REO#T7BD
- X!&"HX
- X`
- Xend
- END_OF_UU.test1
- if test 8715 -ne `wc -c <UU.test1`; then
- echo shar: \"UU.test1\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f autotri.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"autotri.c\"
- else
- echo shar: Extracting \"autotri.c\" \(7624 characters\)
- sed "s/^X//" >autotri.c <<'END_OF_autotri.c'
- X/*
- X * Automatic guessing based on trigrams.
- X *
- X * Bob Baldwin, January 1985.
- X */
- X
- X#include <stdio.h>
- X#include <math.h>
- X#include "window.h"
- X#include "terminal.h"
- X#include "layout.h"
- X#include "specs.h"
- X#include "cipher.h"
- X#include "autotri.h"
- X
- X
- X#define DEBUGP FALSE /* Perm building */
- X#define DEBUGB FALSE /* Best guess */
- X
- X#define ATRLABEL1 \
- X"Auto Trigram, max SD: %4.2f total: %d wire: %d -- Please Wait"
- X#define ATRLABEL2 \
- X"Auto Trigram, max SD: %4.2f total: %d wire: %d -- Done"
- X#define ATRHELP "F3 enters guess, ^G undoes it."
- X
- X
- Xextern char mcbuf[];
- Xextern ecinfo gecinfo;
- Xextern atrdraw(), atrfirst(), atrenter(), atrundo();
- X
- X/* Gloabal State. */
- Xchar *trigramstats; /* Filename for statistics. */
- Xatrinfo gatrinfo;
- Xkeyer atrktab[] = {
- X {CACCEPT, atrenter},
- X {CUNDO, atrundo},
- X {CGO_UP, jogup},
- X {CGO_DOWN, jogdown},
- X {CGO_LEFT, jogleft},
- X {CGO_RIGHT, jogright},
- X {0, NULL},
- X };
- X
- X/* Routine invoked by user to put up the equivalence class
- X * guessing window.
- X * The window is drawn empty, and then filled in with the guess.
- X * Return NULL if command completes ok.
- X */
- Xchar *atrguess(str)
- Xchar *str; /* Command line */
- X{
- X gwindow *atr;
- X atrinfo *atri;
- X ecinfo *ecbi;
- X int *dbsperm;
- X int i, c;
- X int classpos;
- X int x, y;
- X
- X atr = &gbstore;
- X atri = &gatrinfo;
- X dbsperm = refperm(dbsgetblk(&dbstore));
- X atr_init(mcbuf, dbsperm, atri);
- X ecbi = atri->eci;
- X atri->min_total_chars = 123;
- X atri->min_wire_chars = 456;
- X
- X if ((i = sscanf(str, "%*[^:]: %f %*[^:]: %d %*[^:]: %d",
- X &atri->max_score, &atri->min_total_chars,
- X &atri->min_wire_chars)) != 3) {
- X return("Could not parse all three arguments.");
- X }
- X
- X gbsswitch(atr, ((char *) atri), atrktab, atrfirst, wl_noop, atrdraw);
- X
- X sprintf(statmsg, ATRLABEL1,
- X atri->max_score, atri->min_total_chars, atri->min_wire_chars);
- X gblset(&gblabel, statmsg);
- X atrdraw(atr);
- X fflush(stdout);
- X
- X atr_autoguess(atri);
- X decode(ecbi->ciphertext, ecbi->plaintext, ecbi->perm);
- X
- X sprintf(statmsg, ATRLABEL2,
- X atri->max_score, atri->min_total_chars, atri->min_wire_chars);
- X gblset(&gblabel, statmsg);
- X atrdraw(atr);
- X
- X return(NULL);
- X}
- X
- X
- X/* (re) Draw the window.
- X */
- Xatrdraw(atr)
- Xgwindow *atr;
- X{
- X int i;
- X int row, col;
- X atrinfo *atri;
- X ecinfo *ecbi;
- X
- X atri = ((atrinfo *) atr->wprivate);
- X ecbi = atri->eci;
- X row = 1;
- X col = 1;
- X
- X for (i = 0 ; i < BLOCKSIZE ; i++) {
- X if (i%LINELEN == 0) {
- X wl_setcur(atr, gbspos2row(i), gbspos2col(i));
- X }
- X plnchars(1, char2sym(ecbi->plaintext[i]));
- X }
- X
- X for (i = gbspos2row(BLOCKSIZE) ; i <= GBHEIGHT ; i++) {
- X wl_setcur(atr, i, 1);
- X plnchars(LINELEN, ' ');
- X }
- X
- X for (i = 1 ; i <= GBHEIGHT ; i++) {
- X wl_setcur(atr, i, LINELEN+1);
- X plnchars(atr->wwidth - LINELEN, ' ');
- X }
- X
- X wl_setcur(atr, row, col);
- X}
- X
- X
- X/* First time cursor enters window.
- X */
- Xatrfirst(atr, row, col)
- Xgwindow *atr;
- Xint row, col;
- X{
- X usrhelp(&user, ATRHELP);
- X wl_setcur(atr, row, col);
- X}
- X
- X
- X/* Enter the guess into the decryption block.
- X */
- Xatrenter(atr)
- Xgwindow *atr;
- X{
- X atrinfo *atri;
- X
- X atri = ((atrinfo *) atr->wprivate);
- X dbsmerge(&dbstore, atri->eci->perm);
- X wl_rcursor(atr);
- X}
- X
- X
- X/* Undo the last guess.
- X */
- Xatrundo(atr)
- Xgwindow *atr;
- X{
- X dbsundo(&dbstore);
- X wl_rcursor(atr);
- X}
- X
- X
- X/* Fill in auto-trigram info from given ciphertext block.
- X * The filter parameters are not set by this routine.
- X */
- Xatr_init(cipher, perm, atri)
- Xchar cipher[];
- Xint perm[];
- Xatrinfo *atri;
- X{
- Xextern int *trig_loaded;
- X int i;
- X
- X atri->eci = &gecinfo;
- X if (!trig_loaded)
- X load_tri_from(trigramstats);
- X ec_init(cipher, perm, atri->eci);
- X atr_guess_init(atri);
- X}
- X
- X
- X/* Per guess initialization.
- X */
- Xatr_guess_init(atri)
- Xatrinfo *atri;
- X{
- X atri->best_trigram = NULL;
- X atri->best_score = 10.0;
- X atri->gcount = 0;
- X atri->total_score = 0;
- X atri->best_pvec[0] = NONE;
- X atri->best_permvec[0].x = NONE;
- X}
- X
- X
- X
- X/* Score a trigram at a given position.
- X * It also looks in atri for filtering parameters (total number
- X * of chars must not be less than min_total_chars, and the minimum number
- X * of chars deduced per wire must not be less than min_wire_chars).
- X * This routine fills in permvec and pvec.
- X * Returns -1.0 if guess is unacceptable.
- X */
- Xfloat atr_score(atri, trigent, pos, permvec, pvec)
- Xatrinfo *atri;
- Xtrig_ent *trigent;
- Xint pos;
- Xperment permvec[];
- Xint pvec[];
- X{
- X int length;
- X int i, x, y;
- X int ccount;
- X int added;
- X extern float logvar;
- X float score;
- X ecinfo *eci;
- X int butfirst;
- X int butlast;
- X
- X for (length = 0 ; trigent->trigram[length] != 0 ; length++);
- X eci = atri->eci;
- X added = permvec_from_string(atri->eci, trigent->trigram, pos, permvec);
- X if (added < 0) return(-1.0);
- X
- X butfirst = pos;
- X butlast = pos + length -1;
- X ccount = 0;
- X
- X for (i = 0 ; i < PERMSZ && permvec[i].x != NONE ; i++) {
- X if (ccount >= BLOCKSIZE-1) break;
- X x = permvec[i].x;
- X y = permvec[i].y;
- X/* added = decode_wire_but(eci, x, y, &pvec[ccount], -1, -1);*/
- X added = decode_wire_but(eci, x, y, &pvec[ccount], butfirst, butlast);
- X if (added < 0) {
- X ccount = 0;
- X break;
- X }
- X if (added < atri->min_wire_chars) {
- X ccount = 0;
- X break;
- X }
- X ccount += added;
- X }
- X pvec[ccount] = -1;
- X
- X if (ccount <= 0) return(-1.0);
- X if (ccount < atri->min_total_chars) return(-1.0);
- X
- X score = pvec_1score(pvec);
- X if (score < 0.0) return(-1.0);
- X/*
- X score = exp(-(score * score) / 2.0);
- X score = score / sqrt(2*PI*logvar/ccount);
- X score = score * trigent->prob;
- X*/
- X return(score);
- X}
- X
- X
- X/* Select the best trigram for a given position.
- X * Returns pointer to trigram string, or NULL.
- X * Fills in atri with additional information.
- X * Filtering parameters are in atri.
- X */
- Xchar *atr_best(atri, pos)
- Xatrinfo *atri;
- Xint pos;
- X{
- X int tgram;
- X float score;
- X perment permvec[PERMSZ];
- X int pvec[BLOCKSIZE+1];
- X#if DEBUGB
- X char str[BLOCKSIZE+1];
- X#endif
- X
- X atr_guess_init(atri);
- X
- X for (tgram = 0 ; trig_tab[tgram].trigram != NULL ; tgram++) {
- X score = atr_score(atri, &trig_tab[tgram], pos, permvec, pvec);
- X if (score < 0.0) continue;
- X atri->total_score += score;
- X atri->gcount++;
- X if (score < atri->best_score) {
- X atri->best_score = score;
- X atri->best_trigram = trig_tab[tgram].trigram;
- X pvec_copy(pvec, atri->best_pvec);
- X permvec_copy(permvec, atri->best_permvec, PERMSZ);
- X }
- X }
- X
- X#if DEBUGB
- X if (atri->best_score < atri->max_score) {
- X printf("\nTrigram '%s' at %d", atri->best_trigram, pos);
- X pvec2str(str, atri->best_pvec);
- X printf(" deduces '%s'", str);
- X printf(" which scores as %g", atri->best_score);
- X printf(".\n");
- X }
- X#endif
- X
- X if (atri->best_score < atri->max_score)
- X {return(atri->best_trigram);}
- X else
- X {return(NULL);}
- X}
- X
- X
- X/* Merge the given permvector into the permutation table.
- X * Return ERROR if there is a conflict, otherwise TRUE.
- X */
- Xint accept_permvec(atri, permvec)
- Xatrinfo *atri;
- Xperment permvec[];
- X{
- X int i, x, y;
- X ecinfo *ecbi;
- X
- X ecbi = atri->eci;
- X for (i = 0 ; i < PERMSZ && permvec[i].x != NONE ; i++) {
- X x = MODMASK & permvec[i].x;
- X y = MODMASK & permvec[i].y;
- X if (perm_conflict(ecbi->perm, x, y)) {
- X#if DEBUGP
- X printf("CONFLICT trying to wire %d to %d.\n", x, y);
- X#endif
- X return(ERROR);
- X }
- X }
- X
- X
- X /* Now know that there are no conflicts. */
- X for (i = 0 ; i < PERMSZ && permvec[i].x != NONE ; i++) {
- X#if DEBUGP
- X printf("ACCEPTING wiring of %d to %d.\n", x, y);
- X#endif
- X x = MODMASK & permvec[i].x;
- X y = MODMASK & permvec[i].y;
- X ecbi->perm[x] = y;
- X ecbi->perm[y] = x;
- X }
- X
- X return(TRUE);
- X}
- X
- X
- X
- X/* Perform automatic guessing given a set of
- X * filter parameters in an atrinfo structure.
- X */
- Xatr_autoguess(atri)
- Xatrinfo *atri;
- X{
- X int pos;
- X char *trigram;
- X
- X for (pos = 0 ; pos < BLOCKSIZE ; pos++) {
- X trigram = atr_best(atri, pos);
- X if (trigram != NULL) {
- X accept_permvec(atri, atri->best_permvec);
- X }
- X }
- X}
- END_OF_autotri.c
- if test 7624 -ne `wc -c <autotri.c`; then
- echo shar: \"autotri.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f dline.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"dline.c\"
- else
- echo shar: Extracting \"dline.c\" \(6929 characters\)
- sed "s/^X//" >dline.c <<'END_OF_dline.c'
- X/*
- X * Library of display line routines.
- X *
- X * Robert W. Baldwin, December 1984.
- X */
- X
- X#include <stdio.h>
- X#include "window.h"
- X#include "specs.h"
- X
- X
- X/* After clrdline is called the routines assume that there is
- X * a null character terminating the string at index w->wwidth.
- X * That is, the length of the display string is always equal
- X * the the (fixed) width of the line.
- X * The dl_length field behaves like the apparent string length.
- X * It is the column location of the last non-blank character.
- X * That is, an all blank line has a length of zero.
- X */
- X
- X/* INTERNAL PROCEDURES */
- X
- X/* Set the range of positions between firstcol and lastcol (inclusive) to
- X * the given string. The string is padded on the right with spaces
- X * or truncated to make it fill the interval.
- X */
- Xsetarange(line, str, firstcol, lastcol)
- Xdispline *line;
- Xchar *str;
- Xint firstcol, lastcol;
- X{
- X int i;
- X
- X line->dl_length = 0;
- X for (i = firstcol-1 ; i < lastcol ; i++) {
- X if (*str == 0) break;
- X if (*str != ' ') line->dl_length = i+1;
- X line->dl_chars[i] = *str++;
- X }
- X
- X for ( ; i < lastcol ; i++) {
- X line->dl_chars[i] = ' ';
- X }
- X
- X line->dl_chars[i] = '\000';
- X}
- X
- X
- X
- X/* PUBLIC PROCEDURES */
- X
- X
- X
- X/* Set the line from column, col, onward to the given string,
- X * padding with blanks if needed. Note col = 1, set the whole line.
- X * This cannot be used to initialize a display line. It does not
- X * set the character preceeding col.
- X */
- Xsetnadline(line, str, col)
- Xdispline *line;
- Xchar *str;
- Xint col;
- X{
- X setarange(line, str, col, line->wwidth);
- X}
- X
- X
- X/* Blank out all the characters in a displine.
- X */
- Xclrdline(line)
- Xdispline *line;
- X{
- X line->dl_length = 0;
- X setarange(line, "", 1, line->wwidth);
- X}
- X
- X
- X/* Set the entire displine to the given string, padding with blanks.
- X * This fills in the null termination, so it can be used to initialize
- X * a display line.
- X */
- Xsetadline(line, str)
- Xdispline *line;
- Xchar *str;
- X{
- X line->dl_length = 0;
- X setarange(line, str, 1, line->wwidth);
- X}
- X
- X
- X/* Set characters in the given range to the string, truncating
- X * if necessary. Do not pad with blanks, just avoid overflowing
- X * the range.
- X */
- Xsetrange(line, str, firstcol, lastcol)
- Xdispline *line;
- Xchar *str;
- Xint firstcol, lastcol; /* Inclusive interval. */
- X{
- X int i;
- X int newlength;
- X
- X newlength = 0;
- X for (i = firstcol-1 ; i < lastcol ; i++) {
- X if (*str == 0) return;
- X if (*str != ' ') newlength = i+1;
- X line->dl_chars[i] = *str++;
- X }
- X
- X if (newlength > line->dl_length) line->dl_length = newlength;
- X}
- X
- X
- X
- X/* Starting at column, col, set the characters in the display line, line,
- X * to the given string, str.
- X * This differs from setnadline because it does not pad the line with blanks.
- X * Overflows are avoided by truncation.
- X * Note that col is a one-based position, not zero-based as strings are.
- X * This cannot be used to initialize a line, since it does not set the
- X * characters before column col.
- X */
- Xsetndline(line, str, col)
- Xdispline *line;
- Xchar *str;
- Xint col;
- X{
- X setrange(line, str, col, line->wwidth);
- X}
- X
- X
- X/* Set the variable part of the line (between min and max_col) to
- X * the given string. Pad with blanks.
- X */
- Xdlsetvar(line, str)
- Xdispline *line;
- Xchar *str;
- X{
- X setarange(line, str, line->dl_min_col, line->dl_max_col);
- X}
- X
- X
- X
- X/* Fill the given buffer from the given range of column positions.
- X * Trailing blanks are not removed.
- X */
- Xgetrange(line, buf, firstcol, lastcol)
- Xdispline *line;
- Xchar *buf;
- Xint firstcol, lastcol;
- X{
- X int i;
- X
- X for (i = firstcol-1 ; i < lastcol ; i++) {
- X *buf++ = line->dl_chars[i];
- X }
- X *buf = '\000';
- X}
- X
- X
- X/* Fill the given character buffer with a null terminated string
- X * corresponding to the part of the dline between the min and max
- X * column positions. Trailing blanks are not removed.
- X */
- Xdlgetvar(line, buf)
- Xdispline *line;
- Xchar *buf;
- X{
- X getrange(line, buf, line->dl_min_col, line->dl_max_col);
- X}
- X
- X
- X
- X/* EDITING PROCEDURES */
- X
- X
- X/* Insert the given character at the current cursor position.
- X * Do nothing if the line would become too long.
- X * Do nothing if the character is not printable.
- X * The cursor moves to the right one column, provided it doesn't
- X * move past dl_max_col.
- X */
- Xdlinsert(line, k)
- Xdispline *line;
- Xkey k;
- X{
- X char restbuf[MAXWIDTH+1]; /* Char from cursor to end. */
- X char insbuf[2]; /* Char to insert. */
- X
- X if (line->dl_length >= line->wwidth) return;
- X if (!printable(k)) return;
- X
- X getrange(line, restbuf, line->wcur_col, line->wwidth);
- X
- X insbuf[0] = k;
- X insbuf[1] = '\000';
- X setrange(line, insbuf, line->wcur_col, line->wcur_col);
- X
- X setrange(line, restbuf, line->wcur_col+1, line->wwidth);
- X
- X dlright(line);
- X}
- X
- X
- X/* Delete the character at the current cursor position and
- X * shuffle down the rest of the line.
- X * The cursor doesn't move.
- X * The non-blank length is correctly maintained.
- X */
- Xdldelete(line)
- Xdispline *line;
- X{
- X char *p;
- X char linebuf[MAXWIDTH+1]; /* Rebuild whole line here. */
- X
- X getrange(line, linebuf, 1, line->wcur_col-1);
- X
- X for (p = linebuf ; *p != '\000' ; p++); /* p pts to end of line. */
- X getrange(line, p, line->wcur_col+1, line->wwidth);
- X
- X setadline(line, linebuf);
- X}
- X
- X
- X/* Move the cursor right within min and max column.
- X */
- Xdlright(line)
- Xdispline *line;
- X{
- X if (line->wcur_col+1 <= line->dl_max_col)
- X line->wcur_col++;
- X}
- X
- X
- X/* Move the cursor left within min and max column.
- X */
- Xdlleft(line)
- Xdispline *line;
- X{
- X if (line->wcur_col-1 >= line->dl_min_col)
- X line->wcur_col--;
- X}
- X
- X
- X
- X/* DISPLAY UPDATING PROCEDURES */
- X
- X
- X/* Redraw routine for a display line.
- X */
- Xwl_dldraw(dline)
- Xdispline *dline;
- X{
- X int oldcolumn;
- X
- X oldcolumn = dline->wcur_col;
- X
- X wl_setcur(dline, 1, 1);
- X plstring(dline->dl_chars);
- X wl_setcur(dline, 1, oldcolumn);
- X}
- X
- X
- X/* Insert a character an redisplay the line.
- X */
- Xwl_dlinsert(line, k)
- Xdispline *line;
- Xkey k;
- X{
- X dlinsert(line, k);
- X wl_dldraw(line);
- X}
- X
- X
- X/* Delete the current character an redisplay the line.
- X */
- Xwl_dlfdel(line, k)
- Xdispline *line;
- Xkey k;
- X{
- X dldelete(line, k);
- X wl_dldraw(line);
- X}
- X
- X
- X/* Delete the previous character an redisplay the line.
- X * The cursor moves backwards one position.
- X */
- Xwl_dlbdel(line, k)
- Xdispline *line;
- Xkey k;
- X{
- X if (line->wcur_col == line->dl_min_col) return;
- X
- X dlleft(line);
- X dldelete(line, k);
- X wl_dldraw(line);
- X}
- X
- X
- X/* Move cursor right and update display.
- X */
- Xwl_dlright(line)
- Xdispline *line;
- X{
- X dlright(line);
- X wl_rcursor(line);
- X}
- X
- X
- X/* Move cursor left and update display.
- X */
- Xwl_dlleft(line)
- Xdispline *line;
- X{
- X dlleft(line);
- X wl_rcursor(line);
- X}
- X
- X
- X/* Clear the variable part of the display line and update the display.
- X */
- Xwl_dlclr(line)
- Xdispline *line;
- X{
- X dlsetvar(line, "");
- X line->wcur_col = line->dl_min_col;
- X wl_dldraw(line);
- X}
- X
- X
- X/* Scan for the first argument place holder, '%',
- X * position the cursor there, and delete it.
- X * Do nothing if the line doesn't contain a '%'.
- X */
- Xwl_nxtarg(line)
- Xdispline *line;
- X{
- X int i;
- X
- X for (i = line->dl_min_col-1 ; i < line->dl_max_col ; i++) {
- X if (line->dl_chars[i] != '%') continue;
- X wl_setcur(line, 1, i+1);
- X wl_dlfdel(line);
- X break;
- X }
- X}
- END_OF_dline.c
- if test 6929 -ne `wc -c <dline.c`; then
- echo shar: \"dline.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f specs.h -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"specs.h\"
- else
- echo shar: Extracting \"specs.h\" \(6537 characters\)
- sed "s/^X//" >specs.h <<'END_OF_specs.h'
- X/*
- X * Specifications of inter-module dependencies.
- X *
- X * Robert W. Baldwin, December 1984.
- X */
- X
- X
- X/* General Information. */
- X
- X/* A pvec is an 'string' of integers that represent plaintext
- X * characters. The string is terminated by a -1.
- X * A pbuf is a fixed length array of integers that represent plaintext
- X * characters. A value of -1 means that the characters is unknown.
- X * A cbuf is a fixed length array of bytes that represent ciphertext chars.
- X * A perm is a mapping from shifted ciphertext characters to shifted
- X * plaintext characters. Each character is shifted (incremented) by
- X * its offset in the block of 256 characters that contain it.
- X * A gsi is a data structure about a guess that includes information
- X * on the characters that are assumed to be right.
- X * An eci is a data structure that descibes a block of cipher and
- X * plain text.
- X * A string is a null terminated vector of bytes.
- X */
- X
- X
- Xextern twindow banner;
- Xextern twindow webster;
- Xextern twindow dblabel;
- Xextern gwindow dbstore;
- Xextern twindow gblabel;
- Xextern gwindow gbstore;
- Xextern twindow user;
- X
- Xextern gwindow *ibanner();
- Xextern gwindow *iwebster();
- Xextern gwindow *idblabel();
- Xextern gwindow *idbstore();
- Xextern gwindow *igblabel();
- Xextern gwindow *igbstore();
- Xextern gwindow *iuser();
- X
- Xextern char *savestr();
- Xextern int substrp(/* big, little */);
- Xextern int read_slashed(/* *string */);
- X
- Xextern char *(quitcmd(/* arg-string */));
- Xextern char *(lpbguess(/* arg-string */));
- Xextern char *(atrguess(/* arg-string */));
- Xextern char *(kntguess(/* arg-string */));
- Xextern char *(ecbguess(/* arg-string */));
- Xextern char *(pwdguess(/* arg-string */));
- Xextern char *(permsave(/* arg-string */));
- Xextern char *(permload(/* arg-string */));
- Xextern char *(webmatch(/* arg-string */));
- Xextern char *(clearzee(/* arg-string */));
- Xextern char *(pgate(/* arg-string */));
- X
- Xextern char *(cmddo(/* cmdtab, string */));
- Xextern char *(cmdcomplete(/* cmdtab, string */));
- Xextern gblset(/* w, string */);
- Xextern gbsswitch(/* w, private, keytable, firsttime, lasttime, draw */);
- Xextern gbsclear(/* w */);
- Xextern hstadd(/* w, string */);
- Xextern usrstatus(/* w, string */);
- Xextern usrhelp(/* w, string */);
- Xextern dblbnum(/* w, int */);
- Xextern int dbsmerge(/* w, perm */);
- Xextern dbssetblk(/* w, int */);
- Xextern int dbsgetblk(/* w */);
- Xextern dbstrypq(/* ecbi, pque_hdr, pos */);
- X
- Xextern float score(/* pbuf */);
- Xextern float gsi_1score(/* gsi */); /* Uses 1st order stats. */
- Xextern float gsi_2score(/* gsi */); /* Uses 2nd order stats. */
- Xextern float var_1score(/* pvec */); /* Uses first order stats. */
- Xextern float prob_1score(/* pvec */); /* Uses first order stats. */
- Xextern float pvec_1score(/* pvec */); /* Uses first order stats. */
- Xextern load_1stats(); /* Loads first order stats. */
- Xextern print_1stats();
- X
- Xextern int decode(/* cbuf, pbuf, perm */); /* FALSE if has bad chars. */
- X/* Return -1 if bad chars, otherwise # of chars added to pvec. */
- Xextern int decode_wire(/* eci, x, y, pvec */);
- X/* Returns -1 if bad chars, otherwise # of chars added to pvec. */
- Xextern int decode_class(/* eci, firstpos, firstplain, pvec */);
- X/* Returns number of wires added to permvec assuming that plaintext
- X * str occurs at pos. Fills in permvec. Returns -1 if conflict. */
- Xextern int perm_from_string(/* eci, str, pos, permvec */);
- X/* Fills in pvec with the plaintext characters deduced
- X * from the wires in permvec that are not in the positions
- X * ranging from butfirst to butlast. Returns -1 if any
- X * non-ascii chars are deduced, else count of chars. */
- Xextern int permvec2pvec(/* eci, permvec, pvec, butfirst, butlast */);
- Xextern permvec_copy(/* from, to, maxnum */);
- Xextern pvec_copy(/* from, to, maxnum */);
- Xextern print_pvec(/* stream, pvec */);
- Xextern char2buf(/* cbuf, pbuf, length */); /* Fills in pbuf. */
- Xextern buf2char(/* cbuf, pbuf, length, nonechar */); /* Fill cbuf. */
- Xextern str2pvec(/* string, pvec */); /* Fills in pvec. */
- Xextern pvec2str(/* string, pvec */); /* Fills in string. */
- X
- Xextern int fillcbuf(/* blocknum, *cbuf */); /* Ret TRUE if sucessful. */
- Xextern int *refperm(/* blocknum */); /* Ret NULL if fails. */
- Xextern copyperm(/* src, dst */);
- Xextern readperm(/* fd, permbuffer */); /* Gets chars from fd to fill perm. */
- Xextern writeperm(/* fd, permbuffer */); /* Writes perm to file. */
- Xextern multperm(/* left, right, result = (left)(right) */);
- Xextern expperm(/* src, dst, k */); /* dst = src ** k. */
- Xextern int permcount(/* perm */); /* Return # values != -1. */
- Xextern int permwcount(/* perm */); /* Return # of wires. */
- X
- Xextern approx_init(); /* Call before fexp or isqrt. */
- Xextern float fexp(/* float */); /* Fast exp func. */
- Xextern float isqrt[]; /* Sqrts of integers < BLOCKSIZE */
- X
- X
- X/* Globals State */
- Xextern char *cipherfile; /* Ciphertext file name. */
- Xextern char *permfile; /* Permutation save file name. */
- Xextern char *letterstats; /* Single letter stat file name. */
- Xextern char *bigramstats; /* Letter pair statistics file name. */
- Xextern char *trigramstats; /* Trigram statistics file name. */
- Xextern int permchgflg; /* TRUE if perms chged since save. */
- Xextern char statmsg[]; /* Buffer to build status messages. */
- X
- X
- X/* Extensions to C */
- X#ifndef reg
- X#define reg register
- X#endif
- X#define abs(x) (((x) > 0) ? x : (0 - x))
- X
- X
- X/* Macros */
- X#define graphic(c) (c & SYMBOL)
- X#define notascii(c) (c>127)
- X#define printable(c) ((32 <= c) && (c <= 126))
- X#define lletter(c) (('a'<= (c)) && ((c) <= 'z'))
- X#define uletter(c) (('A'<= (c)) && ((c) <= 'Z'))
- X#define isspace(c) ( ((c) == ' ') || ((c) == '\t') || ((c) == '\n') )
- X#define isletter(c) (lletter(c) || uletter(c))
- X#define tolower(c) ( uletter(c) ? ((c) - 'A' + 'a') : (c) )
- X
- X
- X/* Constants */
- X#define BLOCKSIZE 256 /* Number of chars in a cipher block. */
- X#define MODMASK 0377 /* Arithmetic mod 256. */
- X#define CHARMASK 0177 /* ASCII char mask. */
- X#define MAXCHAR 127 /* Highest ASCII value. */
- X#define MXBIINDEX 40 /* Num different chars in a bigram. */
- X#define LINELEN 64 /* Number of characters per line. */
- X#define NLINES 4 /* Number of line pairs. */
- X#define NONE (-1) /* No info on something. */
- X#define ERROR (-1) /* Procedure can't meet normal case specs. */
- X#define EOL (-37) /* A hack used by read_char() */
- X#define PI (3.1415926)
- X#define NPERMS 15 /* Max number of blocks in a file. */
- X
- X#ifndef TRUE
- X#define TRUE 1 /* The whole truth. */
- X#endif
- X#ifndef FALSE
- X#define FALSE 0 /* Lies, falsehoods, etc. */
- X#endif
- X#ifndef NULL
- X#define NULL 0 /* A zero by any other name ... */
- X#endif
- END_OF_specs.h
- if test 6537 -ne `wc -c <specs.h`; then
- echo shar: \"specs.h\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f test.txt -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"test.txt\"
- else
- echo shar: Extracting \"test.txt\" \(6305 characters\)
- sed "s/^X//" >test.txt <<'END_OF_test.txt'
- XThe data may be passed to the procedure through value
- Xparameters, and return values obtained through reference parameters.
- XThe caller is suspended pending the return of the callee. However,
- Xinvocations differ from local procedure calls in several important
- Xways. The first, which is particular to Eden, is the requirement of
- Xan accompanying capability to name to the target Eject. Therefore,
- Xthe Eject programmer is quite aware of the fact that an invocation is
- Xnot "just another procedure call". A second difference is
- Xperformance. Invocations will be far slower than a local procedure
- Xcall simply because there is more going on. The Eden kernel must
- Xlocal the target Eject; network traffic may be necessary if the target
- XEject is not on the same machine; parameters must be packaged into a
- Xmessage to be sent to the target Eject; the target Eject must
- Xunpackage the message and call the desired procedure with the
- Xparameter values; the target Eject must package the results into a
- Xmessage to be sent to the invoking Eject; finally, the invoking Eject
- Xmust unpackage the results and return them to the calling procedure.
- XIn light of such a performance deficit, Eject programmers may be
- Xreluctant to structure a particular collection of Ejects in novel ways
- Xin order to avoid the invocation overhead.
- X
- XThe thesis of this paper is to demonstrate that acceptable performance
- Xfor invocations can be obtained in the Eden environment by paying
- Xclose attention to the design and implementation of modules that
- Xsupport remote procedure calls. For the purposes of this thesis, the
- Xscope will be limited to the Ejects' point of view. The Eden kernel
- Xwill not be considered.
- X
- X\section{Some Background}\label{introbck}
- X
- XEden has had a long history of improvements to its invocation
- Xmechanism. Previous work has concentrated on removing extraneous {\it
- Xinter-process communication} (IPC) messages. Particularly in Eden's
- Xcase, IPC messages are very expensive. Eden is built on top of Unix;
- Xtherefore, each IPC message from an Eject to the Eden kernel, and vice
- Xversa, involves at least a Unix process switch and copying the IPC
- Xmessage into and out of the Unix kernel.
- X
- XThe first versions of Eden required 14 IPC messages to be sent per
- Xlocal invocation. A local invocation occurs when the invoking Eject
- Xand the target Eject reside on the same physical machine.
- XWhat was 2-process kernel's role in this setup?
- X
- XThe 2-process Eden kernel was finally replaced by a 1-process Eden
- Xkernel, immediately reducing the number of messages required for an
- Xinvocation by eliminating the IPC messages between the two kernel
- Xprocesses.
- X
- XThe final reduction in IPC messages sent per invocation occurred
- Xduring the summer of 1984. Two more IPC messages were eliminated.
- XOne of the messages eliminated was the IPC message from the Eden
- Xkernel to the invoking Eject that communicated the {\it invocation
- Xhandle} assigned to that particular call. It was replaced by a scheme
- Xwhere the invoking Eject was allowed to generate its own {\it local
- Xinvocation handle} to communicate with the Eden kernel, and the Eden
- Xkernel would generate its own unique handle in order to communicate
- Xwith another Eden kernel or the target Eject. The Eden kernel
- Xguarantees that the reply message to an invocation will be stamped
- Xwith the invoking Eject-generated handle. The other IPC message
- Xeliminated was the status message from the Eden kernel to the target
- XEject confirming the kernel's approval of the reply message (format,
- Xor contents if capabilities were contained in the reply). The more
- Xlogical scheme of notifying the invoking Eject of the failure status
- Xof the reply, or the actual reply if the status was success, is now
- Xbeing used. The result of all these improvements is shown in figure
- X\ref{oldfig}. (See section \ref{oldexp} for an explanation of figure
- X\ref{oldfig}.)
- X
- X\section{Related Work}\label{introrel}
- X
- XNelson's thesis thoroughly examines remote procedure calls. He
- Xstudies a number of implementations, and proposes a design for
- XEmmisary(?), a new RPC mechanism with excellent transparency and
- Xexceptional performance. To attain exceptional performance, Nelson
- Xgives a list of "lessons" that an RPC mechanism must have. The
- Xlessons are summarized here for the reader:
- X
- X\begin{itemize}
- X\end{itemize}
- X
- XIn designing an RPC mechanism, it is convenient to use a layer model.
- XHowever, strict adherance to the layer model often results in poor
- Ximplementations. There is a prohibitive cost associated with highly
- Xmodular implementations that cannot be tolerated in RPC
- Ximplementations. In proposing a solution to the asynchrony
- Xproblem, Cooper\cite{soft} advocates "soft layering". The idea of soft
- Xlayering may be applied to any naturally layered system whose layers
- Xmust work well together.
- X
- X\section{Structure of Thesis}\label{introstruct}
- X
- XChapter \ref{old} examines the deficiencies of the current Eden
- Xinvocation mechanism. The reader is taken on a tour through the
- Xprocess of initiating an invocation and receiving its reply, and
- Xreceiving a new invocation and replying to the invocation.
- X
- XChapter \ref{new} proposes restructuring the dispatcher module for
- Xsynchronous invocations (by far the most heavily used form of
- Xcommunication within Eden) and breaking down the "hard layering" that
- Xcurrently exists between the various layers that support invocations,
- Xfrom the Eject's point of view, in order to obtain significant
- Xperformance gains.
- X
- X\chapter{A Closer Look at the Eden Invocation Mechanism}\label{old}
- X
- X\section{The Dispatcher -- Interface and Internals}\label{olddis}
- X
- X\section{Flow of Data -- CIP, Stub, and ESCII}\label{olddat}
- X
- X\section{Summary}\label{oldsum}
- X
- X\chapter{An Alternative Synchronous Invocation Mechanism}\label{new}
- X
- X\section{Assumptions and Limitations}\label{newass}
- X
- X\section{The Dispatcher -- Interface and Internals}\label{newdis}
- X
- X\section{A Word About Buffer Management}\label{newbuf}
- X
- X\section{Flow of Data -- CIP, Stub, and ESCII}\label{newdat}
- X
- X\section{Results and Timings}\label{newres}
- X
- X\section{Summary}\label{newsum}
- X
- X\chapter{Conclusions and Further Work}\label{concl}
- X
- X\section{Lessons Re-learned}\label{conles}
- X
- X\section{Soft Layering}\label{conlay}
- X
- X\section{Modularization and Interfaces}\label{conmod}
- X
- X\section{Further Work}\label{confur}
- X
- X\end{document}
- X
- END_OF_test.txt
- if test 6305 -ne `wc -c <test.txt`; then
- echo shar: \"test.txt\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- if test -f user.c -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"user.c\"
- else
- echo shar: Extracting \"user.c\" \(7027 characters\)
- sed "s/^X//" >user.c <<'END_OF_user.c'
- X/*
- X * User status and command window.
- X *
- X * Robert W. Baldwin, December 1984.
- X *
- X * Bob Baldwin 10/86.
- X * Formatting changes.
- X * Change usrdown to fix screen fall off bug.
- X * Change usrfirst to fix cursor pos so jumpcmd() works.
- X */
- X
- X
- X#include <stdio.h>
- X#include "window.h"
- X#include "terminal.h"
- X#include "layout.h"
- X#include "specs.h"
- X#include "parser.h"
- X
- X
- X#define DONEMSG "Command completed."
- X#define USRHLP 1 /* Offset for help line. */
- X#define USRSTAT 2 /* Offset for status line. */
- X#define USRCMD 3 /* Offset for command line. */
- X
- X
- X/* Global space to build status messages. */
- Xchar statmsg[MAXWIDTH+1];
- X
- X
- Xextern int usrfirst(); /* Defined below. */
- Xextern int usrdokey(); /* Defined below. */
- Xextern int usrdraw(); /* Defined below. */
- Xextern int usrup(); /* Defined below. */
- Xextern int usrdown(); /* Defined below. */
- X
- X
- X/* Command table. */
- X#define USRHTEXT \
- X"bigram, knit, prop, load, save, lookup, clear, equiv, auto-tri, pword"
- X
- Xcmdent usrcmdtab[] = {
- X {"quit-program permanently", quitcmd},
- X{"auto-trigram max_dev: % min_total_chars: % min_wire_chars: %", atrguess},
- X {"knitting using blocks from: % to: % Min show count: %", kntguess},
- X {"lookup-pattern: % in dictionary", webmatch},
- X {"equivalence-class guess, use accept level: % (try 2.0)", ecbguess},
- X {"pwords-from file: % Max dev: % (try 1.0)", pwdguess},
- X {"load-permutations", permload},
- X {"save-permutations", permsave},
- X {"clear-zee permutation", clearzee},
- X {"propagate-info from: % to: % using Zee", pgate},
- X {"bigram-guess level: % (2.0), min_prob: % (0.15)", lpbguess},
- X {0, NULL},
- X };
- X
- X
- X/* Keystroke table for the user area. */
- Xextern usrdocmd();
- X
- X/* Keystroke table for the whole user window.
- X * The editing on the command line is handled by a sub-window.
- X */
- Xkeyer usrktab[] = {
- X {CGO_UP, usrup}, /* Keep off help and status lines. */
- X {CGO_DOWN, usrdown}, /* Normal behavior ok. */
- X {CEXECUTE, usrdocmd}, /* Interprete a command. */
- X {0, NULL}, /* Handle other chars elsewhere. */
- X };
- X
- X/* Keystroke table for the command line sub-window.
- X */
- Xkeyer cmdktab[] = {
- X {CNEXTARG, wl_nxtarg},
- X {CGO_LEFT, wl_dlleft}, /* Stay withing variable area. */
- X {CGO_RIGHT, wl_dlright},/* Stay withing variable area. */
- X {CDELF, wl_dlfdel}, /* Delete forward within var area. */
- X {CDELB, wl_dlbdel}, /* Delete backward within var area. */
- X {CCLRLINE, wl_dlclr}, /* Clear variable area. */
- X {CINSERT, wl_dlinsert}, /* All other chars self-insert. */
- X };
- X
- X
- X/* Window for the user commands and program status. */
- X
- Xdispline usraline[USRHEIGHT]; /* Display lines for the user. */
- Xdispline *usrlines[USRHEIGHT+1]; /* Pointers to them plus NULL. */
- X
- Xtwindow user = {
- X USRROW,1, /* Origin. */
- X USRHEIGHT, USRWIDTH, /* Height and width. */
- X USRCMD+1, USRSCOL, /* Initial (relative) cursor pos. */
- X NULL, /* No private data. */
- X usrfirst, /* Firstime = restore cursor pos. */
- X wl_noop, /* Lasttime = do nothing. */
- X usrdraw, /* Default draw routine. */
- X usrdokey, /* Custom keystroke handler. */
- X usrktab, /* Keystroke table. */
- X usrlines,
- X};
- X
- X
- X
- X/* Display a string in the status area.
- X * If the string is empty, this will clear the status area.
- X * Put the cursor back where it was.
- X *
- X * The empty string is special case. If the status line is
- X * empty, then wcur_col = 1. A second request to clear
- X * the line is ignored.
- X * If the line is not empty, wcur_col = dl_min_col.
- X */
- Xusrstatus(w, str)
- Xtwindow *w;
- Xchar *str;
- X{
- X displine *line;
- X int row, col;
- X
- X row = rowcursor();
- X col = colcursor();
- X
- X line = w->dlines[USRSTAT];
- X if (*str == 0 && line->wcur_col == 1)
- X return;
- X
- X dlsetvar(line, str);
- X (*(line->wredraw))(line);
- X setcursor(row, col);
- X
- X line->wcur_col = (*str == 0) ? 1 : 2;
- X}
- X
- X
- X
- X/* Display a string in the help area.
- X * If the string is empty, this will clear the help area.
- X * Put the cursor back where it was.
- X */
- Xusrhelp(w, str)
- Xtwindow *w;
- Xchar *str;
- X{
- X displine *line;
- X int row, col;
- X
- X row = rowcursor();
- X col = colcursor();
- X
- X line = w->dlines[USRHLP];
- X dlsetvar(line, str);
- X (*(line->wredraw))(line);
- X
- X setcursor(row, col);
- X}
- X
- X
- X
- X/* Draw the user area.
- X * Leaves the cursor on the command line.
- X */
- Xusrdraw(w)
- Xtwindow *w;
- X{
- X wl_twdraw(w);
- X}
- X
- X
- X
- X/* Make a window with a title and partial outline.
- X */
- Xgwindow *(iuser())
- X{
- X int i;
- X displine *line, *lines;
- X twindow *w;
- X
- X w = &user;
- X lines = usraline;
- X for (i = 0 ; i < w->wheight ; i++) {
- X line = &lines[i];
- X line->worg_row = w->worg_row + i;
- X line->worg_col = w->worg_col;
- X line->wheight = 1;
- X/* Fix bug on terminals that autowrap. */
- X line->wwidth = (i == USRCMD) ? w->wwidth - 1 : w->wwidth;
- X line->wcur_row = 1;
- X line->wcur_col = USRSCOL;
- X line->wfirst = wl_rcursor;
- X line->wlast = wl_noop;
- X line->wredraw = wl_dldraw;
- X line->wkey = dokey;
- X line->wkeyprocs = arwktab;
- X line->dl_min_col = USRSCOL;
- X line->dl_max_col = line->wwidth;
- X clrdline(line);
- X w->dlines[i] = line;
- X }
- X w->dlines[i] = NULL;
- X
- X line = &lines[USRHLP];
- X setadline(line, "Help : This feature not implemented");
- X line = &lines[USRSTAT];
- X setadline(line, "Status : ");
- X dlsetvar(line, "Just barely working");
- X line = &lines[USRCMD];
- X setadline(line, "Command: ");
- X line->wkeyprocs = cmdktab;
- X
- X return((gwindow *) w);
- X}
- X
- X
- X/* Behavior of the up arrow key.
- X * Move up to the window above us staying in the same column.
- X */
- Xusrup(w, k)
- Xtwindow *w; /* The user window. */
- Xkey k;
- X{
- X wl_setcur(w, 1, w->dlines[USRCMD]->wcur_col);
- X jogup(w, k);
- X}
- X
- X
- X/* Behavior of the down arrow key.
- X * Move to command line.
- X */
- Xusrdown(w, k)
- Xtwindow *w; /* The user window. */
- Xkey k;
- X{
- X wl_setcur(w, USRHEIGHT, w->dlines[USRCMD]->wcur_col);
- X}
- X
- X
- X/* Behavior when cursor first enters the user window.
- X * Move to the command line.
- X */
- Xusrfirst(w, row, col)
- Xtwindow *w;
- Xint row, col; /* Place in window when cursor currently is. */
- X{
- X displine *cmdline;
- X
- X wl_setcur(w, USRHEIGHT, w->dlines[USRCMD]->wcur_col);
- X usrhelp(w, USRHTEXT);
- X cmdline = w->dlines[USRCMD];
- X (*(cmdline->wfirst))(cmdline, 1, col);
- X}
- X
- X
- X/* Keystroke handler for user window.
- X * If it is not an up-arrow or down-arrow, pass it to the command line.
- X */
- Xusrdokey(w, k)
- Xtwindow *w; /* The user window. */
- Xkey k;
- X{
- X char *expanded; /* Expanded command line. */
- X char cmdbuf[MAXWIDTH+1];
- X displine *cmdline;
- X
- X cmdline = w->dlines[USRCMD];
- X usrstatus(&user, "");
- X if (ddokey(w, k, w->wkeyprocs)) { /* If handled by top window. */
- X return; /* Includes doit key. */
- X }
- X
- X if (k == ((CINSERT << CMDSHIFT) | SPACE)) {
- X dlgetvar(cmdline, cmdbuf);
- X expanded = cmdcomplete(usrcmdtab, cmdbuf);
- X if (expanded != NULL) {
- X dlsetvar(cmdline, expanded);
- X wl_dldraw(cmdline);
- X return;
- X }
- X }
- X (*(cmdline->wkey))(cmdline, k); /* Else pass to sub-window. */
- X}
- X
- X
- X/* Interprete a command.
- X */
- Xusrdocmd(usr)
- Xtwindow *usr;
- X{
- X char cmdbuf[MAXWIDTH+1];
- X char *errmsg;
- X displine *cmdline;
- X
- X cmdline = usr->dlines[USRCMD];
- X wl_setcur(usr, usr->wcur_row, cmdline->wcur_col);
- X dlgetvar(cmdline, cmdbuf);
- X if ((errmsg = cmddo(usrcmdtab, cmdbuf)) == NULL)
- X errmsg = DONEMSG;
- X usrstatus(&user, errmsg);
- X}
- END_OF_user.c
- if test 7027 -ne `wc -c <user.c`; then
- echo shar: \"user.c\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- echo shar: End of archive 4 \(of 11\).
- cp /dev/null ark4isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 11 archives.
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
- --
- Rich $alz rsalz@pineapple.bbn.com
- Cronus Project, BBN Labs "Anger is an energy"
-